class Solution:
    def findPermutationDifference(self, s: str, t: str) -> int:
        s_map = {}
        for i, e in enumerate(s):
            s_map[e] = i
        sum = 0
        for j, e in enumerate(t):
            sum += abs(s_map[e] - j)
        return sum


if __name__ == '__main__':
    s1 = "abc"
    t1 = "bac"
    s = Solution()

    print(s.findPermutationDifference(s1, t1))
